From 7a5e8495786e141f9426932f0fec28a754b1ce35 Mon Sep 17 00:00:00 2001 From: "cl349@freefall.cl.cam.ac.uk" Date: Wed, 10 Nov 2004 14:32:43 +0000 Subject: [PATCH] bitkeeper revision 1.1159.1.400 (4192268botrLPEWBvExDtqcSivVN3g) Move virq to evtchn mapping to exec_domain. --- xen/common/event_channel.c | 15 ++++++++++----- xen/common/keyhandler.c | 8 ++++---- xen/include/xen/event.h | 2 +- xen/include/xen/sched.h | 3 ++- 4 files changed, 17 insertions(+), 11 deletions(-) diff --git a/xen/common/event_channel.c b/xen/common/event_channel.c index d8e7c9b9eb..f3a242ea2e 100644 --- a/xen/common/event_channel.c +++ b/xen/common/event_channel.c @@ -239,10 +239,11 @@ static long evtchn_bind_interdomain(evtchn_bind_interdomain_t *bind) static long evtchn_bind_virq(evtchn_bind_virq_t *bind) { - struct domain *d = current->domain; + struct exec_domain *ed = current; + struct domain *d = ed->domain; int port, virq = bind->virq; - if ( virq >= ARRAY_SIZE(d->virq_to_evtchn) ) + if ( virq >= ARRAY_SIZE(ed->virq_to_evtchn) ) return -EINVAL; spin_lock(&d->event_channel_lock); @@ -252,7 +253,7 @@ static long evtchn_bind_virq(evtchn_bind_virq_t *bind) * bound yet. The exception is the 'misdirect VIRQ', which is permanently * bound to port 0. */ - if ( ((port = d->virq_to_evtchn[virq]) != 0) || + if ( ((port = ed->virq_to_evtchn[virq]) != 0) || (virq == VIRQ_MISDIRECT) || ((port = get_free_port(d)) < 0) ) goto out; @@ -260,7 +261,7 @@ static long evtchn_bind_virq(evtchn_bind_virq_t *bind) d->event_channel[port].state = ECS_VIRQ; d->event_channel[port].u.virq = virq; - d->virq_to_evtchn[virq] = port; + ed->virq_to_evtchn[virq] = port; out: spin_unlock(&d->event_channel_lock); @@ -313,6 +314,7 @@ static long evtchn_bind_pirq(evtchn_bind_pirq_t *bind) static long __evtchn_close(struct domain *d1, int port1) { struct domain *d2 = NULL; + struct exec_domain *ed; event_channel_t *chn1, *chn2; int port2; long rc = 0; @@ -344,7 +346,10 @@ static long __evtchn_close(struct domain *d1, int port1) break; case ECS_VIRQ: - d1->virq_to_evtchn[chn1[port1].u.virq] = 0; + /* XXX could store exec_domain in chn1[port1].u */ + for_each_exec_domain(d1, ed) + if (ed->virq_to_evtchn[chn1[port1].u.virq] == port1) + ed->virq_to_evtchn[chn1[port1].u.virq] = 0; break; case ECS_INTERDOMAIN: diff --git a/xen/common/keyhandler.c b/xen/common/keyhandler.c index 90db32cc6c..b50e01861b 100644 --- a/xen/common/keyhandler.c +++ b/xen/common/keyhandler.c @@ -111,10 +111,10 @@ void do_task_queues(unsigned char key) ed = d->exec_domain[0]; printk("Notifying guest... %d/%d\n", d->id, ed->eid); printk("port %d/%d stat %d %d %d\n", - VIRQ_DEBUG, d->virq_to_evtchn[VIRQ_DEBUG], - test_bit(d->virq_to_evtchn[VIRQ_DEBUG], &d->shared_info->evtchn_pending[0]), - test_bit(d->virq_to_evtchn[VIRQ_DEBUG], &d->shared_info->evtchn_mask[0]), - test_bit(d->virq_to_evtchn[VIRQ_DEBUG]>>5, &ed->vcpu_info->evtchn_pending_sel)); + VIRQ_DEBUG, ed->virq_to_evtchn[VIRQ_DEBUG], + test_bit(ed->virq_to_evtchn[VIRQ_DEBUG], &d->shared_info->evtchn_pending[0]), + test_bit(ed->virq_to_evtchn[VIRQ_DEBUG], &d->shared_info->evtchn_mask[0]), + test_bit(ed->virq_to_evtchn[VIRQ_DEBUG]>>5, &ed->vcpu_info->evtchn_pending_sel)); send_guest_virq(d->exec_domain[0], VIRQ_DEBUG); } diff --git a/xen/include/xen/event.h b/xen/include/xen/event.h index c59439608f..7410c0aa8c 100644 --- a/xen/include/xen/event.h +++ b/xen/include/xen/event.h @@ -57,7 +57,7 @@ static inline void evtchn_set_pending(struct exec_domain *ed, int port) */ static inline void send_guest_virq(struct exec_domain *ed, int virq) { - evtchn_set_pending(ed, ed->domain->virq_to_evtchn[virq]); + evtchn_set_pending(ed, ed->virq_to_evtchn[virq]); } /* diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index e1e06d59f5..8eb1ed015a 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -98,6 +98,8 @@ struct exec_domain unsigned long ed_flags; + u16 virq_to_evtchn[NR_VIRQS]; + atomic_t pausecnt; }; @@ -136,7 +138,6 @@ struct domain { */ #define NR_PIRQS 128 /* Put this somewhere sane! */ u16 pirq_to_evtchn[NR_PIRQS]; - u16 virq_to_evtchn[NR_VIRQS]; u32 pirq_mask[NR_PIRQS/32]; /* Physical I/O */ -- 2.30.2